package cn.hesion;
/**
 * ClassName: JedisPoolDemo <br/>
 * Description: <br/>
 * date: 2021/3/23 8:51<br/>
 *
 * @author Hesion<br />
 * @version
 * @since JDK 1.8
 */

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashSet;

/**
 * @program: JedisPoolDemo
 * @description:
 * @author: hesion
 * @create: 2021-03-23 08:51
 **/
public class JedisPoolDemo {
    public static void main(String[] args) {
        JedisPoolConfig config = new JedisPoolConfig();
        HashSet<HostAndPort> jedisClusterNode = new HashSet<>();
        jedisClusterNode.add(new HostAndPort("192.168.80.150", 7001));
        jedisClusterNode.add(new HostAndPort("192.168.80.150", 7002));
        jedisClusterNode.add(new HostAndPort("192.168.80.150", 7003));
        jedisClusterNode.add(new HostAndPort("192.168.80.150", 7004));
        jedisClusterNode.add(new HostAndPort("192.168.80.150", 7005));
        jedisClusterNode.add(new HostAndPort("192.168.80.150", 7006));
        jedisClusterNode.add(new HostAndPort("192.168.80.150", 7007));
        jedisClusterNode.add(new HostAndPort("192.168.80.150", 7008));
        JedisCluster jcd = new JedisCluster(jedisClusterNode,config);
        jcd.set("name","zhangf");
        String zhangf = jcd.get("name");
        System.out.println(zhangf);
    }
}
